//
//  StellGoodsListTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/11.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "StellGoodsListTableViewCell.h"

@interface StellGoodsListTableViewCell ()
@property(nonatomic,strong) GLGWImageView * goodsImageView;
@property(nonatomic,strong) GLGWLabel * stellNameLaebl;
@property(nonatomic,strong) GLGWLabel * specLaebl;
@property(nonatomic,strong) GLGWLabel * wareHouseLaebl;
@property(nonatomic,strong) GLGWLabel * companyLaebl;
@property(nonatomic,strong) GLGWLabel * piceLaebl;
@property(nonatomic,strong) GLGWButton * changeBut;

@end

@implementation StellGoodsListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * bankgroundView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [bankgroundView setViewShadowWidth:3.0 theCornerRadius:3.0];
        [bankgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kWidthProportion_In_iPhoneTriploid(10));
        }];
        //
        self.goodsImageView = [[GLGWImageView alloc] initInSuperView:bankgroundView];
        self.goodsImageView.backgroundColor = kRandomColor;
        [self.goodsImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(13));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(90)));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(90)));
        }];
        //
        self.stellNameLaebl = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        self.stellNameLaebl.text = @"三级螺纹钢 HRB400E 河钢";
        [self.stellNameLaebl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.goodsImageView.mas_right).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kWidthProportion_In_iPhoneTriploid(22)));
        }];
        //
        self.wareHouseLaebl = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        self.wareHouseLaebl.text = @"北京京南国储库";
        [self.wareHouseLaebl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.stellNameLaebl.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(8));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        //
        self.specLaebl = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
        self.specLaebl.text = @"φ6*12";
        [self.specLaebl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.stellNameLaebl);
            make.top.equalTo(self.stellNameLaebl.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.right.equalTo(self.wareHouseLaebl.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        [self.specLaebl setContentCompressionResistancePriority:(UILayoutPriorityDefaultLow) forAxis:(UILayoutConstraintAxisHorizontal)];
        [self.wareHouseLaebl setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh) forAxis:(UILayoutConstraintAxisHorizontal)];
        //
        GLGWLabel * tongbuLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        tongbuLabel.text = @"同步自";
        [tongbuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.specLaebl);
            make.top.equalTo(self.specLaebl.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        //sel
        self.companyLaebl = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:kColor_Rule_Yellow inSuperView:bankgroundView];
        NSDictionary *attribtDic = @{NSUnderlineStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
        NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:@"北京泽人合有限公司" attributes:attribtDic];
        self.companyLaebl.attributedText = attribtStr;
        [self.companyLaebl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(tongbuLabel.mas_right).offset(0);
            make.top.equalTo(tongbuLabel);
            make.height.equalTo(tongbuLabel);
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
        }];
        //
        self.piceLaebl = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#FF374F"] inSuperView:bankgroundView];
        self.piceLaebl.text = @"¥3845/吨";
        [self.piceLaebl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(tongbuLabel);
            make.top.equalTo(tongbuLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        //
        self.changeBut = [[GLGWButton alloc] initWithTitle:@" 立即同步 " titleLableFont:SYSTEMFONT(12) titleLableColor:[UIColor whiteColor] theCornerRadius:3.0 backgroundColr:kColor_Rule_Yellow inSuperView:bankgroundView];
        [self.changeBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(10));
            make.bottom.equalTo(bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
            make.height.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(25)));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
